package com.sk.weichat.adapter;

import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.weichat.R;
import com.sk.weichat.bean.NewContactsBean;
import com.sk.weichat.helper.AvatarHelper;
import com.sk.weichat.sortlist.BaseSortModel;

import java.util.List;

public class HadAddContactsAdapter extends BaseQuickAdapter<BaseSortModel<NewContactsBean>, BaseViewHolder> {

    public HadAddContactsAdapter(List<BaseSortModel<NewContactsBean>> data) {
        super(R.layout.item_had_add_contacts, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BaseSortModel<NewContactsBean> item) {
        NewContactsBean contact = item.getBean();

        helper.addOnClickListener(R.id.rt_had_add_friends);
        helper.addOnClickListener(R.id.avatar_img);
        ImageView avatarImg = helper.getView(R.id.avatar_img);
        AvatarHelper.getInstance().displayAvatar(contact.getNickName(), contact.getUserId(), avatarImg, true);
        TextView user_name_tv = helper.getView(R.id.user_name_tv);
        user_name_tv.setText(TextUtils.isEmpty(contact.getRemarkName())?contact.getNickName():contact.getRemarkName());

    }
}
